import Vue from 'vue';
// import './cube-ui';
import App from './App.vue';
import router from './router';
import vueg from 'vueg';
import '@/assets/init.css';
import '@/assets/main.styl';
import fastclick from 'fastclick';
import components from './components';

router.onError(error => {
    const pattern = /Loading chunk (\d)+ failed/g;
    const isChunkLoadFailed = error.message.match(pattern);
    const targetPath = router.history.pending.fullPath;
    if (isChunkLoadFailed) {
        router.replace(targetPath);
    }
});

Vue.use(vueg, router);

Vue.use(components);

Vue.config.productionTip = false;

Vue.directive('fixBar', {
    bind(el) {
        el.style.paddingTop = api.safeArea.top + 'px';
    } 
});

window.apiready = function() {
    // fastclick.attach(document.body);
    new Vue({
        router,
        render: h => h(App)
    }).$mount('#app');
};

// new Vue({
//     router,
//     render: h => h(App)
// }).$mount('#app');


